package adapter;

import java.util.List;

import javabeen.CarTypeBeen;

import com.cqtczh.qhd.driver.R;
import com.cqtczh.qhd.driver.model.CargoInfo;

import adapter.OrderListAdapter.ViewHolder;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

/** 
 * @author  作者 E-mail: 
 * @date 创建时间：2015-6-5 上午11:17:01 
 * @version 1.0 
 * @parameter  
 * @since  
 * @return  
 */
public class CarTypeListAdapter extends BaseAdapter {

	public List<CarTypeBeen> CarType;
	private int xml;
	private Context context;
	private LayoutInflater inflater;
	
	public CarTypeListAdapter(Context context,  List<CarTypeBeen> CarType,
			int xml) {
		this.CarType = CarType;
		this.xml = xml;
		this.context = context;
		if (this.context != null) {
			this.inflater = LayoutInflater.from(context);
		}

	}
	
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return CarType.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return CarType.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		final ViewHolder viewHolder;
		if (convertView == null) {
			convertView = inflater.inflate(xml, null);
			viewHolder = new ViewHolder();
//			viewHolder.textView1 = (TextView) convertView
//					.findViewById(R.id.textView1);
			viewHolder.textView2 = (TextView) convertView
					.findViewById(R.id.textView2);
			viewHolder.textView3 = (TextView) convertView
					.findViewById(R.id.textView3);
	//		viewHolder.textView4 = (TextView) convertView
	//				.findViewById(R.id.textView4);
			viewHolder.textView5 = (TextView) convertView
					.findViewById(R.id.textView5);
			viewHolder.textView6 = (TextView) convertView
					.findViewById(R.id.textView6);
		//	viewHolder.textView7 = (TextView) convertView
		//			.findViewById(R.id.textView7);

			convertView.setTag(viewHolder);
		} else {
			viewHolder = (ViewHolder) convertView.getTag();
		}
		CarTypeBeen data = CarType.get(position);
		if (data != null) {

//			viewHolder.textView1.setText("车辆类型编号："+data.getCartypeid());// (R.id.myorder_content_flowid);
			viewHolder.textView2.setText("名称："+data.getCartypename()); // (R.id.myorder_content_tab);
			viewHolder.textView3.setText("" +data.getDescription());// (R.id.myorder_content_zhongtext);description
	//		viewHolder.textView4.setText("起步价："+data.getBasekm()+"(6公里)"); // (R.id.myorder_content_time);
			viewHolder.textView5.setText("起步价："+data.getBaseprice()+"元(6公里)");
			viewHolder.textView6.setText("超出后价格："+data.getOutprice()+"元");
	//		viewHolder.textView7.setText("单价：" +data.getPrice()+""); // (R.id.myorder_content_rmb);
	
		}

		return convertView;
	}

	class ViewHolder {
//		TextView textView1;
		TextView textView2;
		TextView textView3;
	//	TextView textView4;
		TextView textView5;
		TextView textView6;
	//	TextView textView7;
	}
	
	
}
